package com.focus.xyz.other.pages.tpytb;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
 * Created by chenmeng on 2016/3/30.
 */
public class LoginPage {

    @FindBy(xpath = "//input[@name='passPort']")
    private WebElement userName;
    @FindBy(xpath = "//input[@name='passWord']")
    private WebElement password;
    @FindBy(xpath = "//input[@name='validate']")
    private WebElement validateCode;
    @FindBy(xpath = "//img[@alt='登录']")
    private WebElement loginBtn;
//    private WebElement code;

    public LoginPage(WebDriver driver){
        PageFactory.initElements(driver,this);
    }

    public void inputUserName(String userName) throws Exception{
        this.userName.clear();
        this.userName.sendKeys(userName);
    }

    public void inputPassword(String pass) throws Exception{
        this.password.clear();
        this.password.sendKeys(pass);
    }

    public void login() throws Exception{
        this.loginBtn.click();
    }

}
